class ThreadTest2 implements Runnable{
    @Override
    public void run() {
        while (true){
            System.out.println("==========");
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

public class Test2 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new ThreadTest2(),"myThread");
        thread.start();
        while (true){
            System.out.println("===");
            Thread.sleep(2000);
        }
    }
}
